package com.dyg.service.Impl;

import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import com.dyg.service.RedisService;


@Service(value = "redisService")
public class RedisServiceImpl implements RedisService{

	private static String redisCode = "utf-8";
	
	 @Autowired
	 private RedisTemplate<String,Object> redisTemplate;

	@Override
	public long del(final String... keys) {
		return redisTemplate.execute(new RedisCallback() {
			public Long doInRedis(RedisConnection connection) throws DataAccessException {
				   long result = 0;
				   for (int i = 0; i < keys.length; i++) {
				        result = connection.del(keys[i].getBytes());
				    }
			return result;
            }

		});
	}

	@Override
	public void set(byte[] key, byte[] value, long liveTime) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void set(String key, String value, long liveTime) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void set(String key, String value) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void set(byte[] key, byte[] value) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String get(String key) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Set keys(String pattern) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean exists(String key) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public String flushDB() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long dbSize() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String ping() {
		// TODO Auto-generated method stub
		return null;
	}
}
